<!DOCTYPE html>
<html lang="en">

<head>
    <title>Example</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        table {
            border: solid thin black;
            border-collapse: collapse;
        }
        
        td {
            padding: 4px 5px;
        }
    </style>
</head>

<body>
    <table border="1">
        <thead>
            <tr>
                <th>Fruit</th>
                <th>Color</th>
            </tr>
        </thead>
        <tbody id="fruitsBody">
            <tr id="plumrow">
                <td>Plum</td>
                <td>Purple</td>
            </tr>
        </tbody>
    </table>
    <pre id="results"></pre>

    <script>
        var elemByID = document.getElementById('plumrow');
        var elemByPos = document.getElementById('fruitsBody').getElementsByTagName('tr')[0];

        if (elemByID.isSameNode(elemByPos)) {
            document.getElementById('results').innerHTML = "Object are the same";
        }
    </script>
</body>

</html>